$(function () {
    var myChart = echarts.init(document.getElementById('c_map'));
    var option = {
        title: {
            text: '全国新增确诊',
            left: 'center',
            top: '40',
            textStyle: {
                color: '#fff'
            }
        },
        tooltip: {
            trigger: 'item'

        },
//左侧小导航图标
        visualMap: {
            show: true,
            x: 'left',
            y: 'bottom',
            textStyle: {
                fontSize: 10,
                color: '#fff'
            },
            splitList: [{
                start: 0,
                end: 0
            },
                {
                    start: 1,
                    end: 9
                },
                {
                    start: 10,
                    end: 99
                },
                {
                    start: 100,
                    end: 9999
                },
                {
                    start: 1000
                }
            ],
            color: ['#8A3310', '#C64918', '#E55B25', '#F2AD92', '#F9DCD1']
        },

//配置属性
        series: [{
            name: '详细数据',
            type: 'map',
            mapType: 'china',
            roam: false,
            itemStyle: {
                normal: {
                    borderWidth: .5,
                    borderColor: '#009fe8',
                    areaColor: '#ffefd5'
                },
                emphasis: {
                    borderWidth: .5,
                    borderColor: '#4b0082',
                    areaColor: '#fff'
                }
            },
            label: {
                normal: {
                    show: true, //省份名称
                    fontSize: 8
                },
                emphasis: {
                    show: true,
                    fontSize: 8
                }
            },
            data: [] //数据
        }]
    };

    function get_map2_data() {
        $.ajax({
            url: "/c_con",
            async:false,
            success: function (data) {
                option.series[0].data = data.data
                myChart.setOption(option)
            },
            error: function (xhr, type, errorThrown) {
            }
        })
    }
    setInterval(get_map2_data,1000*10)
})

